package org.dtrd.modules.content.articles.entity.bean;

import cn.hutool.extra.pinyin.PinyinUtil;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.dtrd.modules.content.articles.entity.po.DtrdExtEmsYwWords;
import org.springframework.cglib.beans.BeanCopier;

import java.util.Date;

/**
 * 专业词汇
 */
@Data
@NoArgsConstructor
public class Vocabulary {

    private Integer dataId;

    /**
     * 词汇名称
     */
    private String wordName;

    /**
     * 词汇名称拼音
     */
    private String wordNamePinYin;

    /**
     * 首字母
     */
    private char firstLetter;


    /**
     * 词汇标签
     */
    private String wordTips;

    /**
     * 创建时间
     */
    private Date wordCreateTime;

    /**
     * 专业词汇URL
     */
    private String wordUrl;

    /**
     * 词汇解释
     */
    private String wordExplain;

    public Vocabulary(DtrdExtEmsYwWords po) {
        BeanCopier beanCopier = BeanCopier.create(DtrdExtEmsYwWords.class, Vocabulary.class, false);
        beanCopier.copy(po, this, null);
//        this.wordNamePinYin = PinyinUtil.getPinyin(wordName);
        this.firstLetter =Character.toUpperCase(PinyinUtil.getFirstLetter(wordName.charAt(0)));
    }
}